package com.chrray.position.domain;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.chrray.position.enums.YesNoEnum;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import com.baomidou.mybatisplus.annotation.*;
import java.util.Date;
import java.util.List;

/**
 * 用户教育经历表 对象
 *
 * @author wusiwee
 * @email wusiwee@163.com
 * @since 1.0.1 2024-08-07
 */

@Data
@ApiModel(description = "用户教育经历表")
@TableName("fd_edu_experience")
public class FdEduExperience extends Model<FdEduExperience> {
	@ApiModelProperty(value = "主键")
	@TableId(type = IdType.AUTO)
	private Long id;

	@ApiModelProperty(value = "关联用户id")
	private Long userId;

	@ApiModelProperty(value = "学校名称")
	private String schoolName;

	@ApiModelProperty(value = "学习时段开始年份")
	private Integer startYear;

	@ApiModelProperty(value = "学习时段结束年份")
	private Integer endYear;

	@ApiModelProperty(value = "学习专业")
	private String major;

	@ApiModelProperty(value = "排序,可能会有多段经历,需求不明确")
	private Integer sort;

	@ApiModelProperty(value = "创建时间")
	private Date createTime;

	private Integer delFlag;

	public static FdEduExperience findOneByUserId(Long userId) {
		LambdaQueryWrapper<FdEduExperience> queryWrapper = new LambdaQueryWrapper<>();
		queryWrapper.eq(FdEduExperience::getUserId, userId);
		return new FdEduExperience().selectOne(queryWrapper);
	}

	public static List<FdEduExperience> findAllByUserId(Long userId) {
		LambdaQueryWrapper<FdEduExperience> queryWrapper = new LambdaQueryWrapper<>();
		queryWrapper.eq(FdEduExperience::getUserId, userId);
		return new FdEduExperience().selectList(queryWrapper);
	}
}
